#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
namespace std
{
    
    void test1()
    {
        vector<int> v1;
        v1.push_back(1);
        v1.push_back(2);
        vector<int>::iterator it=v1.begin();
        while(it!=v1.end())
        {
            cout<<*it<<endl;
            it++;
        }
        cout<<endl;
        for(auto& e:v1)
        {    
            e++;
            cout<<e<<" ";
        }
        cout<<endl;
    
    }
    void test2()
    {
        vector<int> v;
        v.push_back(1);
        v.push_back(20);
        v.push_back(130);
        v.push_back(23);
        v.push_back(4);
        v.push_back(7);
        v.push_back(98);
        v.push_back(24);
        v.push_back(14);
        sort(v.begin(),v.end());
        for(auto& e:v)
        {
            cout<<e<<' ';
        }
        cout<<endl;

    }

}
//int main(void)
////
////{
////
////    vector<int>array;
////
////    array.push_back(100);
////
////    array.push_back(300);
////
////    array.push_back(300);
////
////    array.push_back(300);
////
////    array.push_back(300);
////
////    array.push_back(500);
////
////    vector<int>::iterator itor;
////
////    for (itor = array.begin(); itor != array.end(); itor++)
////
////    {
////
////        if (*itor == 300)
////
////        {
////
////            itor = array.erase(itor);
////
////        }
////
////    }
////
////    for (itor = array.begin(); itor != array.end(); itor++)
////
////    {
////
////        cout << *itor << " ";
////
////    }
////
////    return 0;
////
////}
////int main(void)
////{
////
////    int ar[] = { 1,2,3,4,5,6,7,8,9,10  };
////
////    int n = sizeof(ar) / sizeof(int);
////
////    vector<int> v(ar, ar + n);
////
////    cout << v.size() << ":" << v.capacity() << endl;
////
////    v.reserve(100);
////
////    v.resize(20);
////
////    cout << v.size() << ":" << v.capacity() << endl;
////
////    v.reserve(50);
////
////    v.resize(5);
////
////    cout << v.size() << ":" << v.capacity() << endl;
////    return 0;
////
////}
//找出出现次数大于半个数组长度的元素
//int MoreThanHalfNum_Solution(vector<int>& numbers) {
//  int candidate = numbers[0];
//      int count = 1;
//   for (int i = 1; i < numbers.size(); i++) {
//   if (numbers[i] == candidate)
//   {
//       count++;
//   }
//   else {
//      count--;
//   }
//   if (count == 0) 
//   {
//      candidate = numbers[++i];
//      count++;
//   }
//   }
//   return candidate;
//   }
//  int main()
//  {
//      vector<int> v;
//      v.push_back(1);
//      v.push_back(2);
//      v.push_back(3);
//      v.push_back(2);
//      v.push_back(2);
//      v.push_back(4);
//      v.push_back(2);
// int ret=MoreThanHalfNum_Solution(v);
//
//   }
//   删除重复项
class Solution {
    public:
        int removeDuplicates(vector<int>& nums) {
            int pre=0;
            int cur=1;
            while(cur<nums.size())
            {
                if(nums[pre]==nums[cur])
                {
                   cur++;                                                            
                }
               else 
               {
                   nums[++pre]=nums[cur++];                                                                             
               }                                                          
         }     
        return pre+1;
                                                
        }

};
int main()
{
    std:: test2();
    return 0;
}
